<?php

/**
 * Some basic settings.
 */

// Root folder, relative to the domain. So for "http://www.example.com/subDir/" this would be "/subDir/"
define("SETTINGS_ROOTFOLDER", "/server/");

// PDO connection string:
define("SETTINGS_PDOCONNECTIONSTRING", "mysql:host=localhost; dbname=dephille_pidgincot");

// DB Username:
define("SETTINGS_DBUSER", "dephille_pidginc");

// DB Password:
define("SETTINGS_DBPASS", "");



/**
 * Automatically requires factories and tables:
 */
function __autoload($class_name) {
	if (strstr($class_name, "Factory")) {
		Logger::log("settings", "Loading factory '" . $class_name . "'.");
		require_once 'Factories/' . $class_name . '.php';
		Logger::log("settings", "Factory loaded.");
	} else if (strstr($class_name, "Table")) {
		Logger::log("settings", "Loading table '" . $class_name . "'.");
		require_once 'DBTables/' . $class_name . '.php';
		Logger::log("settings", "Table loaded.");		
	}
}



/**
 * Requires all modules:
 */
// Load all module filenames:
$tmp = glob("Modules/*.php");

// Require them:
if (is_array($tmp) && (count($tmp) > 0)) {
	foreach ($tmp as $curModule) {
		Logger::log("settings", "Loading module '" . $curModule . "'...");
		require_once $curModule;
	}
	
	// Done:
	Logger::log("settings", "All modules loaded.");
}

// Clean-up:
unset($curModule);
unset($tmp);